<?php
namespace App\Http\Controllers;

use App\Library\Helper;
use App\Models\Doctor;
use App\Models\StErrorLog;
use App\Models\StRemoteRequestUsLog;
use App\Models\StSgReturn;
use Illuminate\Http\Request;

class TestController
{
    public $stSgReturnModel;
    public $stRemoteRequestUsLogModel;
    public $stErrorLogModel;

    public function __construct()
    {
        $this->stSgReturnModel = new StSgReturn();
        $this->stRemoteRequestUsLogModel = new StRemoteRequestUsLog();
        $this->stErrorLogModel = new StErrorLog();

    }

    public function getList(Request $request)
    {
        if (Helper::isProduction()) {
            return false;
        }
        $type = $request->input('type');
        $pagesize = $request->input('pagesize');
        $result = [];
        if ($type == 1) {
            $result = $this->stSgReturnModel->getList('*', [], ['id' => 'desc'], [], $pagesize);
        } else if ($type == 2) {
            $result = $this->stRemoteRequestUsLogModel->getList('*', [], ['id' => 'desc'], [], $pagesize);
        } else if ($type == 3) {
            $result = $this->stErrorLogModel->getList('*', [], ['id' => 'desc'], [], $pagesize);
        }

        return response(['code' => 10000, 'message' => '成功', 'data' => $result]);
    }

    public function getVar()
    {
        echo $_SERVER['SITE_ENV'];die();
    }
}